package ws.performancetest.app.gui.strings;

/**
 * This class provides the application strings.
 *
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public abstract class AppStrings {

  /** Application name. */
  public static final String AppName = "Performance Test Application";
  /** Tabs names. */
  public static final String[] TabsNames = {
    "Run Tests",
    "Database",
    "Report"};
  /* ----- BUTTON LABELS ----- */
  /** Label for the add button. */
  public static final String btAdd = "add";
  /** Label for the cancel button. */
  public static final String btCancel = "cancel";
  /** Label for the clear button. */
  public static final String btClear = "clear";
  /** Label for the close button. */
  public static final String btClose = "Close";
  /** Label for the connect button. */
  public static final String btConnect = "connect";
  /** Label for the create test button. */
  public static final String btCreateTest = "Create";
  /** Label for the remove button. */
  public static final String btRemove = "remove";
  /** Label for the work offline button. */
  public static final String btWorkOffline = "work offline";
  /* ----- PANEL LABELS ----- */
  /** Label for the create table panel. */
  public static final String pnlDatabaseCreateTables = "Create tables";
  /** Label for the drop table panel. */
  public static final String pnlDatabaseDropTables = "Create tables";
  /** Label for the threads sub-panel on {@link CreateTestJPanel}. */
  public static final String pnlThread = "Threads";
  /** Label for the threads amounts. */
  public static final String pnlThreadAmount = "Amount";
  /** Label for the threads categories. */
  public static final String pnlThreadCategory = "Category";
  /* ----- MISC LABELS ----- */
  /** Yes message. */
  public static final String yes = "Yes";
  /** No message. */
  public static final String no = "No";
  /** Wrong connection parameters, message error. */
  public static final String msgParametersError = "<html><b>Wrong parameters!</b><br>"
          + "All parameters are mandatory, so please fill them.";
  /** Unrecognized URL format, message error. */
  public static final String msgURLFormatError = "<html><b>URL format unrecognized!</b><br>"
          + "Unfortunately, I don't know the URL format for the selected driver.";
  /** SQL Exception, message error. */
  public static final String msgSQLException = "<html><b>SQL Exception!</b><br>";
  /** SQL file executed successfully message. */
  public static final String msgSQLExecuted = "SQL file executed successfully.";
  /** Option not available message, when working offline. */
  public static final String msgOptionNotAvailableOffline = "This option is not available when working offline.";
  /**  Test created successfully message. */
  public static final String msgTestCreated = "Test(s) created successfully: ";
  /**  Confirm deletion message. */
  public static final String msgConfirmDelete = "Are you sure that you want to delete?";
  /** Selected file label. */
  public static final String lbSelectedFile = "Selected file:";
  /* ----- MENU LABELS ----- */
  /** Connect to, menu item */
  public static final String menuConnectTo = "Connect to...";
  /** Disconnect, menu item. */
  public static final String menuDisconnect = "Disconnect";
  /** Execute SQL script, menu item. */
  public static final String menuExecuteSQL = "Execute script";

  /**
   * Create a message string with the following format: </br>
   * <p><b>title</b> subtitle</br>
   *    message
   * </p>
   *
   * @param title message title
   * @param subtitle message subtitle
   * @param message message body
   *
   * @return created message, in HTML format.
   */
  public static String createMessage(String title, String subtitle, String message) {
    String msg = "<html><b>" + title + "</b> " + subtitle + "<br>" + message;
    return msg;
  }

  /**
   * Create one message whose title is the name of the exception, and
   * body is the message within that exception.
   *
   * @param ex exception with the information for creating the message.
   *
   * @return created message, in HTML format.
   */
  public static String createExceptionMessage(Exception ex) {
    String msg = "<html><b>" + ex.getClass().getSimpleName() + "</b><br>"
            + ex.getMessage();
    return createMessage(ex.getClass().getSimpleName(), "", ex.getMessage());
  }
}
